﻿﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="stylesheet" type="text/css" href="css/login.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquerySession.js"></script>
    <script type="text/javascript" src="js/config.js"></script>
</head>
<body>
<div class="htmleaf-container">
    <div class="wrapper">
        <div class="container">
            <h1>悦定后台管理系统</h1>
            <form class="form" action="#" method="post">
                <input type="text" name="username" class="login" placeholder="用户名">
                <input type="password" name="passwd" class="password" placeholder="密码">
                <button type="button" id="login-button">登录</button>
            </form>
        </div>
        <!--泡泡-->
        <ul class="bg-bubbles">
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>
    </div>
</div>

<script type="text/javascript">
    $("#login-button").click(function () {
        var loginInput = $(".login"), passwordInInput = $(".password");
        $.post(baseUrl + "/login", {login: loginInput.val(), password: passwordInInput.val()}, function (json) {
            if (json.meta.code == "200") {
                $.session.set("token", json.data);
                window.location.href = "web/user/participant.html"
            }else if(json.meta.code == "40000901"){
                alert("用户无管理权限！");
                loginInput.val("");
                passwordInInput.val("");
            }else {
                alert("用户不存在或密码错误！");
                loginInput.val("");
                passwordInInput.val("");
            }
        })
    })
</script>
</body>
</html>